﻿using System;
using System.IO;
using System.Threading.Tasks;

namespace Smile.Mvvm.Service
{
    /// <summary>Service which manage interaction with operating system lock screen.</summary>
    public class LockScreenService : ILockScreenService
    {
        // @Poperties
        public bool CanSetLockScreen
        {
            get 
            {
                return false;
            }
        }

        public bool IsPair
        {
            get
            {
                return _isPair;
            }
            private set
            {
                _isPair = value;
                ServiceLocator
                    .Retrieve<ISettingsService>()
                    .Add(_pairKey, value);
            }
        }


        // @Public
        public LockScreenService()
        {
        }

        public Task<bool> AuthorizeLockScreenAsync()
        {
            return Task<bool>.Run(() => false);
        }

        public void SetLockScreenAsync(string uriString)
        {
            SetLockScreenAsync(new Uri(uriString, UriKind.Absolute));
        }

        public void SetLockScreenAsync(Uri uri)
        {
        }

        public void SetLockScreenAsync(byte[] buffer)
        {
        }

        public void SetLockScreenAsync(Stream streamToCopy)
        {
        }


        // @Private
        const string    _pairKey = "LockscreenPairKey";
        bool            _isPair = false;

        string GetFilename()
        {
            if (IsPair)
            {
                return "LockScreen_A";
            }
            else
            {
                return "LockScreen_B";
            }
        }
    }
}
